/**
*      author: Y_Yao
*      created: 2025-03-21 18:34:06
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 9e18;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 7;
int n,m,k;
set<int> s[N];//以i为根节点的所有元素集合
map<int,int> mp;//某个集合的颜色计数器
vector<int> f;//根节点集合
int col[N];
int fa[N],sz[N];
bool vis[N];

int find(int x)
{
    return fa[x] == x ? x : fa[x] = find(fa[x]);
}

void Union(int u,int v)
{
    u = find(u);
    v = find(v);
    if(u == v) return;
    if(sz[u] > sz[v]) swap(u,v);
    fa[u] = v;
    sz[v] += sz[u];
}

void solve()
{
    cin >> n >> m >> k;
    for(int i = 1;i <= n;i++)
    {
        fa[i] = i;
        sz[i] = 1;
    }
    for(int i = 1;i <= n;i++)
    {
        cin >> col[i];
    }
    for(int i = 1;i <= m;i++)
    {
        int u,v;
        cin >> u >> v;
        vis[u] = vis[v] = true;
        Union(u,v);
    }

    for(int i = 1;i <= n;i++)
    {
        s[find(i)].insert(i);
        if(fa[i] == i && vis[i])
        {
            f.push_back(i);
        }
    }
    int ans = 0;
    for(int i = 0;i < f.size();i++)
    {
        mp.clear();
        int mx = 0;
        for(auto& e : s[f[i]])
        {
            mp[col[e]]++;
            mx= max(mx,mp[col[e]]);
        }
        ans += sz[f[i]] - mx;
    }
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}